#include "Tree.h"

BTNode* buyNode(BTDatatype x)
{
	BTNode* node = (BTNode*)malloc(sizeof(BTNode));
	if (node == NULL)
	{
		perror("malloc");
		return NULL;
	}
	node->data = x;
	node->left = node->right = NULL;
}

BTNode* CreatTree()
{
	BTNode* nodeA = buyNode('A');
	BTNode* nodeB = buyNode('B');
	BTNode* nodeC = buyNode('C');
	BTNode* nodeD = buyNode('D');
	BTNode* nodeE = buyNode('E');
	BTNode* nodeF = buyNode('F');

	nodeA->left = nodeB;
	nodeA->right = nodeC;
	nodeB->left = nodeD;
	nodeC->left = nodeE;
	nodeC->right = nodeF;

	return nodeA;
}

void test()
{
	BTNode* root = CreatTree();
	//PreOrder(root);
	//InOrder(root);
	//PostOrder(root);
	//printf("size: %d\n", BinaryTreeSize(root));
	//printf("size: %d\n", BinaryTreeSize(root));
	//printf("%d", BinaryTreeLeveSize(root));
	//printf("%d", BinaryTreeLevelKSize(root,2));
	printf("%d", BinaryTreeDepth(root));
}


int main()
{
	test();
	return 0;
}